# coding=utf-8
a = input().split(';')
b = [0, 0]
for item in a:
    if len(item) >= 2:
        aj = item[0]
        bushu = item[1:]
        try:
            bushu = int(bushu)
            if aj in ['A', 'W', 'S', 'D'] and int(bushu) < 100:
                if aj == 'A':
                    b[0] -= bushu
                elif aj == 'D':
                    b[0] += bushu
                elif aj == 'W':
                    b[1] += bushu
                else:
                    b[1] -= bushu
        except:
            pass
print('{0},{1}'.format(b[0], b[1]))
